<template>
  <div class="home">
    <!-- {{formateMsg}}
    {{formateMsg}}
    {{formateMsg}}
    {{formateMsg}}
    <button @click="changeMsg">点击修改msg</button> -->
    商品价格--- {{sumPrice}}
    商品价格--- {{sumPrice}}
    商品价格--- {{sumPrice}}
    商品价格--- {{sumPrice}}
    <button @click="changePrice">修改商品价格</button>
  </div>
</template>

<script>
export default {
  name: 'Home',
  data() {
    return {
      msg: 'hello',
      price: 0
    }
  },
  computed: {
    formateMsg() {
      return this.msg.split('').reverse().join('')
    },
    
    sumPrice: {
      get() {
        return this.price
      },

      set(val) {
        // console.log(val);
        this.price = val
      }
    }
  },

  // created() {
  //   console.log(this);
  // }
  methods: {
    changeMsg() {
      // this.formateMsg = 'dlrow'
    },

    changePrice() {
      this.sumPrice = 1234
    }
  }
}
</script>
